<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>新闻列表</title>
	<script src="{{'/js/jquery.min.js'}}"></script>
	<style>
		a{
			text-decoration:none;
			color:#e35b9c;
		}
		.pagination {
		  padding-left: 75%;
		  margin: 22px 0;
		  border-radius: 4px;
		}

		.pagination>li {
		  display: inline
		}

		.pagination>li>a,.pagination>li>span {
		  position: relative;
		  float: left;
		  padding: 6px 12px;
		  line-height: 1.6;
		  text-decoration: none;
		  color: #3097D1;
		  background-color: #fff;
		  border: 1px solid #ddd;
		  margin-left: -1px
		}

		.pagination>li:first-child>a,.pagination>li:first-child>span {
		  margin-left: 0;
		  border-bottom-left-radius: 4px;
		  border-top-left-radius: 4px
		}

		.pagination>li:last-child>a,.pagination>li:last-child>span {
		  border-bottom-right-radius: 4px;
		  border-top-right-radius: 4px
		}

		.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover {
		  z-index: 2;
		  color: #216a94;
		  background-color: #eee;
		  border-color: #ddd
		}

		.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover {
		  z-index: 3;
		  color: #fff;
		  background-color: #3097D1;
		  border-color: #3097D1;
		  cursor: default
		}

		.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover {
		  color: #777;
		  background-color: #fff;
		  border-color: #ddd;
		  cursor: not-allowed
		}
	</style>

</head>
<body>
	<input type="hidden" name="_token" value="{{csrf_token()}}" id="token">
	<p>这里是新闻列表</p>
	<button class="btn"><a href="{{url('/outLogin')}}">退出登录</a></button><br><br>
	@foreach($info as $v)
	<div style="border:1px solid #ccc; width:60%; margin-bottom: 20px;">
		<a href="{{'/news/detailsNews'}}/{{$v->id}}">
			<div>
				<h4>{{$v->title}}</h4>
				<p>{!! $v->describe !!}</p>
				<span style="color:#928aeb;">{{$v->createtime}}</span>
			</div>
		</a>
	</div>
	@endforeach
	<p><span style="color:#5e53e6;">{{$user_name}}</span>的评论:</p>
	<textarea name="" id="text" cols="60" rows="5" value="请输入"></textarea><br>
	<button type="button" class='comment_btn'>发表评论</button>
	{{$info->links()}}
<script>
$(function(){
	$('.comment_btn').click(function(){
		if($('#text').val() == '') {
			alert('评论内容不能为空');
			return false;
		}
		var content = $('#text').val();
		var data = {
				content:content,
		};
		data['_token'] = $('#token').val();
		var url = '/comment/comment';
		$.post(url,data,function(rest){
			alert('发表评论成功');
			location.replace(location.href);
		});
	});
});


</script>

</body>
</html>